-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add aws_codestarconnections_connection resource #15990
Add aws_codestarconnections_connection resource #15990
Conversation
b585c07
to
6942de9
Compare
Co-authored-by: Kévin Sénéchal <kevin.senechal@gmail.com>
6942de9
to
222c479
Compare
@bflad I've created the second part of the PR to support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @shuheiktgw, it's looking good. I have a few suggestions for additions to the resource
"arn": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
|
||
"connection_arn": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally, we prefer to follow the API, but in the case of "standard" outputs such as arn
, it's ok to just have the arn
and remove connection_arn
Computed: true, | ||
}, | ||
|
||
"connection_name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be renamed to name
. It doesn't match the API, but it's a common pattern for resources to use the name
parameter, and the resource type aws_codestarconnections_connection
already mentions "connection" twice 🙂
Optionally, we can also use the name generation documented at https://github.com/hashicorp/terraform-provider-aws/blob/master/docs/contributing/contribution-checklists.md#adding-resource-name-generation-support
|
||
res, err := conn.CreateConnection(params) | ||
if err != nil { | ||
return fmt.Errorf("error creating codestar connection: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer error messages to use the Go 1.13 error wrapping verb %w
.
For user-facing output, we should use the styling used by AWS
return fmt.Errorf("error creating codestar connection: %s", err) | |
return fmt.Errorf("error creating CodeStar connection: %w", err) |
func resourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta interface{}) error { | ||
conn := meta.(*AWSClient).codestarconnectionsconn | ||
|
||
rule, err := conn.GetConnection(&codestarconnections.GetConnectionInput{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rule
should probably be renamed, since it doesn't return a rule. We often use resp
.
rule, err := conn.GetConnection(&codestarconnections.GetConnectionInput{ | |
resp, err := conn.GetConnection(&codestarconnections.GetConnectionInput{ |
@gdavison Thank you for your review! Let me fix them quickly 👍 |
Co-authored-by: Graham Davison <g.m.davison@computer.org>
@gdavison Thank you for your great reviews! I believe I fixed them up so would you review the PR again? 😄
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, @shuheiktgw! LGTM 🚀
--- PASS: TestAccAWSCodeStarConnectionsConnection_disappears (10.42s)
--- PASS: TestAccAWSCodeStarConnectionsConnection_Basic (14.08s)
This has been released in version 3.22.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Relates #15453, #15960
Closes #12637
Closes #11389
Release note for CHANGELOG:
Output from acceptance testing:
This is the second part of a PR to add
aws_codestarconnections_connection
resource (the first part: #15960). This PR originally came from #12637. Thank you for your review!